// import Vue from 'vue'
// const throttle = Vue.directive('repeatDirective', {
//   bind: function(el, binding) {
//     let timer = null
//     el.addEventListener('click', function() {
//       if (!timer) {
//         binding.value()
//         timer = setTimeout(() => {
//           timer = null
//         }, 1000)
//       }
//     })
//   }
// })
// export default throttle
function throttle(callback, wait) {
  let timer = null
  return function() {
    if (!timer) {
      callback()
      timer = setTimeout(() => {
        timer = null
      }, wait)
    }
  }
}
export default {
  bind: function(el, binding) {
    el.addEventListener('click', throttle(binding.value, 2000))
  }
}
